package com.example.demo.data.jpa.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.data.jpa.dao.PersionDao;
import com.example.demo.data.jpa.entity.Persion;

@RequestMapping("jpa")
@RestController
public class PersionController {
	@Autowired
	private PersionDao persionDao;
	
	@RequestMapping("list")
	public List<Persion> list(){
		return persionDao.findAll();
	}
	
	@RequestMapping("get")
	public Persion get(String id){
		return persionDao.findOne(id);
	}
	
	@RequestMapping("getByName")
	public List<Persion> getByName(String name){
		return persionDao.findByNameContaining(name);
	}
	
	@RequestMapping("getByName1")
	public List<Persion> getByName1(String name){
		return persionDao.findByName(name);
	}
	
}
